﻿//------------------------------------------------------------------------------

using System;
using System.Data.Objects;
using System.Data.Objects.DataClasses;
using System.Data.EntityClient;
using System.ComponentModel;
using System.Xml.Serialization;
using System.Runtime.Serialization;

[assembly: EdmSchemaAttribute()]
#region EDM Relationship Metadata

[assembly: EdmRelationshipAttribute("EntitiesModel", "FK_Accounts_Tenants", "Tenant", System.Data.Metadata.Edm.RelationshipMultiplicity.One, typeof(AbstractSaaSTemplate.Infrastructure.Win2K8WithSQLServer.Repositories.Core.Tenant), "Account", System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(AbstractSaaSTemplate.Infrastructure.Win2K8WithSQLServer.Repositories.Core.Account), true)]
[assembly: EdmRelationshipAttribute("EntitiesModel", "FK_Credentials_Users", "User", System.Data.Metadata.Edm.RelationshipMultiplicity.ZeroOrOne, typeof(AbstractSaaSTemplate.Infrastructure.Win2K8WithSQLServer.Repositories.Core.User), "Credential", System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(AbstractSaaSTemplate.Infrastructure.Win2K8WithSQLServer.Repositories.Core.Credential), true)]
[assembly: EdmRelationshipAttribute("EntitiesModel", "FK_UserRole_Users", "User", System.Data.Metadata.Edm.RelationshipMultiplicity.One, typeof(AbstractSaaSTemplate.Infrastructure.Win2K8WithSQLServer.Repositories.Core.User), "UserRole", System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(AbstractSaaSTemplate.Infrastructure.Win2K8WithSQLServer.Repositories.Core.UserRole), true)]
[assembly: EdmRelationshipAttribute("EntitiesModel", "FK_Templates_Tenants", "Tenant", System.Data.Metadata.Edm.RelationshipMultiplicity.ZeroOrOne, typeof(AbstractSaaSTemplate.Infrastructure.Win2K8WithSQLServer.Repositories.Core.Tenant), "Template", System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(AbstractSaaSTemplate.Infrastructure.Win2K8WithSQLServer.Repositories.Core.Template), true)]
[assembly: EdmRelationshipAttribute("EntitiesModel", "FK_UserTenants_Tenants", "Tenant", System.Data.Metadata.Edm.RelationshipMultiplicity.One, typeof(AbstractSaaSTemplate.Infrastructure.Win2K8WithSQLServer.Repositories.Core.Tenant), "UserTenant", System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(AbstractSaaSTemplate.Infrastructure.Win2K8WithSQLServer.Repositories.Core.UserTenant), true)]
[assembly: EdmRelationshipAttribute("EntitiesModel", "FK_UserTenants_Users", "User", System.Data.Metadata.Edm.RelationshipMultiplicity.One, typeof(AbstractSaaSTemplate.Infrastructure.Win2K8WithSQLServer.Repositories.Core.User), "UserTenant", System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(AbstractSaaSTemplate.Infrastructure.Win2K8WithSQLServer.Repositories.Core.UserTenant), true)]
[assembly: EdmRelationshipAttribute("EntitiesModel", "FK_Address_Tenants", "Tenant", System.Data.Metadata.Edm.RelationshipMultiplicity.ZeroOrOne, typeof(AbstractSaaSTemplate.Infrastructure.Win2K8WithSQLServer.Repositories.Core.Tenant), "Address", System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(AbstractSaaSTemplate.Infrastructure.Win2K8WithSQLServer.Repositories.Core.Address), true)]
[assembly: EdmRelationshipAttribute("EntitiesModel", "FK_Phones_Tenants", "Tenant", System.Data.Metadata.Edm.RelationshipMultiplicity.ZeroOrOne, typeof(AbstractSaaSTemplate.Infrastructure.Win2K8WithSQLServer.Repositories.Core.Tenant), "Phone", System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(AbstractSaaSTemplate.Infrastructure.Win2K8WithSQLServer.Repositories.Core.Phone), true)]
[assembly: EdmRelationshipAttribute("EntitiesModel", "FK_InstanceSetups_Accounts", "Account", System.Data.Metadata.Edm.RelationshipMultiplicity.ZeroOrOne, typeof(AbstractSaaSTemplate.Infrastructure.Win2K8WithSQLServer.Repositories.Core.Account), "InstanceSetup", System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(AbstractSaaSTemplate.Infrastructure.Win2K8WithSQLServer.Repositories.Core.InstanceSetup), true)]
[assembly: EdmRelationshipAttribute("EntitiesModel", "FK_InstanceSetups_Tenants", "Tenant", System.Data.Metadata.Edm.RelationshipMultiplicity.ZeroOrOne, typeof(AbstractSaaSTemplate.Infrastructure.Win2K8WithSQLServer.Repositories.Core.Tenant), "InstanceSetup", System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(AbstractSaaSTemplate.Infrastructure.Win2K8WithSQLServer.Repositories.Core.InstanceSetup), true)]
[assembly: EdmRelationshipAttribute("EntitiesModel", "FK_InstanceSetups_Blobs", "Blob", System.Data.Metadata.Edm.RelationshipMultiplicity.ZeroOrOne, typeof(AbstractSaaSTemplate.Infrastructure.Win2K8WithSQLServer.Repositories.Core.Blob), "InstanceSetup", System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(AbstractSaaSTemplate.Infrastructure.Win2K8WithSQLServer.Repositories.Core.InstanceSetup), true)]
[assembly: EdmRelationshipAttribute("EntitiesModel", "FK_UserAccounts_Accounts", "Account", System.Data.Metadata.Edm.RelationshipMultiplicity.One, typeof(AbstractSaaSTemplate.Infrastructure.Win2K8WithSQLServer.Repositories.Core.Account), "UserAccount", System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(AbstractSaaSTemplate.Infrastructure.Win2K8WithSQLServer.Repositories.Core.UserAccount), true)]
[assembly: EdmRelationshipAttribute("EntitiesModel", "FK_UserAccounts_Users", "User", System.Data.Metadata.Edm.RelationshipMultiplicity.One, typeof(AbstractSaaSTemplate.Infrastructure.Win2K8WithSQLServer.Repositories.Core.User), "UserAccount", System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(AbstractSaaSTemplate.Infrastructure.Win2K8WithSQLServer.Repositories.Core.UserAccount), true)]

#endregion

namespace AbstractSaaSTemplate.Infrastructure.Win2K8WithSQLServer.Repositories.Core
{
    #region Contexts
    
    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    internal partial class ConnectorForSQL2K8 : ObjectContext
    {
        #region Constructors
    
        /// <summary>
        /// Initializes a new ConnectorForSQL2K8 object using the connection string found in the 'ConnectorForSQL2K8' section of the application configuration file.
        /// </summary>
        public ConnectorForSQL2K8() : base("name=ConnectorForSQL2K8", "ConnectorForSQL2K8")
        {
            this.ContextOptions.LazyLoadingEnabled = true;
            OnContextCreated();
        }
    
        /// <summary>
        /// Initialize a new ConnectorForSQL2K8 object.
        /// </summary>
        public ConnectorForSQL2K8(string connectionString) : base(connectionString, "ConnectorForSQL2K8")
        {
            this.ContextOptions.LazyLoadingEnabled = true;
            OnContextCreated();
        }
    
        /// <summary>
        /// Initialize a new ConnectorForSQL2K8 object.
        /// </summary>
        public ConnectorForSQL2K8(EntityConnection connection) : base(connection, "ConnectorForSQL2K8")
        {
            this.ContextOptions.LazyLoadingEnabled = true;
            OnContextCreated();
        }
    
        #endregion
    
        #region Partial Methods
    
        partial void OnContextCreated();
    
        #endregion
    
        #region ObjectSet Properties
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<Tenant> Tenants
        {
            get
            {
                if ((_Tenants == null))
                {
                    _Tenants = base.CreateObjectSet<Tenant>("Tenants");
                }
                return _Tenants;
            }
        }
        private ObjectSet<Tenant> _Tenants;
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<Credential> Credentials
        {
            get
            {
                if ((_Credentials == null))
                {
                    _Credentials = base.CreateObjectSet<Credential>("Credentials");
                }
                return _Credentials;
            }
        }
        private ObjectSet<Credential> _Credentials;
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<Account> Accounts
        {
            get
            {
                if ((_Accounts == null))
                {
                    _Accounts = base.CreateObjectSet<Account>("Accounts");
                }
                return _Accounts;
            }
        }
        private ObjectSet<Account> _Accounts;
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<UserRole> UserRoles
        {
            get
            {
                if ((_UserRoles == null))
                {
                    _UserRoles = base.CreateObjectSet<UserRole>("UserRoles");
                }
                return _UserRoles;
            }
        }
        private ObjectSet<UserRole> _UserRoles;
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<RoleFeature> RoleFeatures
        {
            get
            {
                if ((_RoleFeatures == null))
                {
                    _RoleFeatures = base.CreateObjectSet<RoleFeature>("RoleFeatures");
                }
                return _RoleFeatures;
            }
        }
        private ObjectSet<RoleFeature> _RoleFeatures;
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<User> Users
        {
            get
            {
                if ((_Users == null))
                {
                    _Users = base.CreateObjectSet<User>("Users");
                }
                return _Users;
            }
        }
        private ObjectSet<User> _Users;
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<Template> Templates
        {
            get
            {
                if ((_Templates == null))
                {
                    _Templates = base.CreateObjectSet<Template>("Templates");
                }
                return _Templates;
            }
        }
        private ObjectSet<Template> _Templates;
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<UserTenant> UserTenants
        {
            get
            {
                if ((_UserTenants == null))
                {
                    _UserTenants = base.CreateObjectSet<UserTenant>("UserTenants");
                }
                return _UserTenants;
            }
        }
        private ObjectSet<UserTenant> _UserTenants;
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<Address> Addresses
        {
            get
            {
                if ((_Addresses == null))
                {
                    _Addresses = base.CreateObjectSet<Address>("Addresses");
                }
                return _Addresses;
            }
        }
        private ObjectSet<Address> _Addresses;
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<Phone> Phones
        {
            get
            {
                if ((_Phones == null))
                {
                    _Phones = base.CreateObjectSet<Phone>("Phones");
                }
                return _Phones;
            }
        }
        private ObjectSet<Phone> _Phones;
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<InstanceSetup> InstanceSetups
        {
            get
            {
                if ((_InstanceSetups == null))
                {
                    _InstanceSetups = base.CreateObjectSet<InstanceSetup>("InstanceSetups");
                }
                return _InstanceSetups;
            }
        }
        private ObjectSet<InstanceSetup> _InstanceSetups;
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<Blob> Blobs
        {
            get
            {
                if ((_Blobs == null))
                {
                    _Blobs = base.CreateObjectSet<Blob>("Blobs");
                }
                return _Blobs;
            }
        }
        private ObjectSet<Blob> _Blobs;
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<Message> Messages
        {
            get
            {
                if ((_Messages == null))
                {
                    _Messages = base.CreateObjectSet<Message>("Messages");
                }
                return _Messages;
            }
        }
        private ObjectSet<Message> _Messages;
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<UserAccount> UserAccounts
        {
            get
            {
                if ((_UserAccounts == null))
                {
                    _UserAccounts = base.CreateObjectSet<UserAccount>("UserAccounts");
                }
                return _UserAccounts;
            }
        }
        private ObjectSet<UserAccount> _UserAccounts;

        #endregion
        #region AddTo Methods
    
        /// <summary>
        /// Deprecated Method for adding a new object to the Tenants EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToTenants(Tenant tenant)
        {
            base.AddObject("Tenants", tenant);
        }
    
        /// <summary>
        /// Deprecated Method for adding a new object to the Credentials EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToCredentials(Credential credential)
        {
            base.AddObject("Credentials", credential);
        }
    
        /// <summary>
        /// Deprecated Method for adding a new object to the Accounts EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToAccounts(Account account)
        {
            base.AddObject("Accounts", account);
        }
    
        /// <summary>
        /// Deprecated Method for adding a new object to the UserRoles EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToUserRoles(UserRole userRole)
        {
            base.AddObject("UserRoles", userRole);
        }
    
        /// <summary>
        /// Deprecated Method for adding a new object to the RoleFeatures EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToRoleFeatures(RoleFeature roleFeature)
        {
            base.AddObject("RoleFeatures", roleFeature);
        }
    
        /// <summary>
        /// Deprecated Method for adding a new object to the Users EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToUsers(User user)
        {
            base.AddObject("Users", user);
        }
    
        /// <summary>
        /// Deprecated Method for adding a new object to the Templates EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToTemplates(Template template)
        {
            base.AddObject("Templates", template);
        }
    
        /// <summary>
        /// Deprecated Method for adding a new object to the UserTenants EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToUserTenants(UserTenant userTenant)
        {
            base.AddObject("UserTenants", userTenant);
        }
    
        /// <summary>
        /// Deprecated Method for adding a new object to the Addresses EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToAddresses(Address address)
        {
            base.AddObject("Addresses", address);
        }
    
        /// <summary>
        /// Deprecated Method for adding a new object to the Phones EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToPhones(Phone phone)
        {
            base.AddObject("Phones", phone);
        }
    
        /// <summary>
        /// Deprecated Method for adding a new object to the InstanceSetups EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToInstanceSetups(InstanceSetup instanceSetup)
        {
            base.AddObject("InstanceSetups", instanceSetup);
        }
    
        /// <summary>
        /// Deprecated Method for adding a new object to the Blobs EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToBlobs(Blob blob)
        {
            base.AddObject("Blobs", blob);
        }
    
        /// <summary>
        /// Deprecated Method for adding a new object to the Messages EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToMessages(Message message)
        {
            base.AddObject("Messages", message);
        }
    
        /// <summary>
        /// Deprecated Method for adding a new object to the UserAccounts EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToUserAccounts(UserAccount userAccount)
        {
            base.AddObject("UserAccounts", userAccount);
        }

        #endregion
    }
    

    #endregion
    
    #region Entities
    
    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="EntitiesModel", Name="Account")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class Account : EntityObject
    {
        #region Factory Method
    
        /// <summary>
        /// Create a new Account object.
        /// </summary>
        /// <param name="id">Initial value of the Id property.</param>
        /// <param name="tenantId">Initial value of the TenantId property.</param>
        /// <param name="name">Initial value of the Name property.</param>
        /// <param name="createdAt">Initial value of the CreatedAt property.</param>
        public static Account CreateAccount(global::System.Int64 id, global::System.Int64 tenantId, global::System.String name, global::System.DateTime createdAt)
        {
            Account account = new Account();
            account.Id = id;
            account.TenantId = tenantId;
            account.Name = name;
            account.CreatedAt = createdAt;
            return account;
        }

        #endregion
        #region Primitive Properties
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 Id
        {
            get
            {
                return _Id;
            }
            set
            {
                if (_Id != value)
                {
                    OnIdChanging(value);
                    ReportPropertyChanging("Id");
                    _Id = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("Id");
                    OnIdChanged();
                }
            }
        }
        private global::System.Int64 _Id;
        partial void OnIdChanging(global::System.Int64 value);
        partial void OnIdChanged();
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 TenantId
        {
            get
            {
                return _TenantId;
            }
            set
            {
                OnTenantIdChanging(value);
                ReportPropertyChanging("TenantId");
                _TenantId = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("TenantId");
                OnTenantIdChanged();
            }
        }
        private global::System.Int64 _TenantId;
        partial void OnTenantIdChanging(global::System.Int64 value);
        partial void OnTenantIdChanged();
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String Name
        {
            get
            {
                return _Name;
            }
            set
            {
                OnNameChanging(value);
                ReportPropertyChanging("Name");
                _Name = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("Name");
                OnNameChanged();
            }
        }
        private global::System.String _Name;
        partial void OnNameChanging(global::System.String value);
        partial void OnNameChanged();
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.DateTime CreatedAt
        {
            get
            {
                return _CreatedAt;
            }
            set
            {
                OnCreatedAtChanging(value);
                ReportPropertyChanging("CreatedAt");
                _CreatedAt = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("CreatedAt");
                OnCreatedAtChanged();
            }
        }
        private global::System.DateTime _CreatedAt;
        partial void OnCreatedAtChanging(global::System.DateTime value);
        partial void OnCreatedAtChanged();

        #endregion
    
        #region Navigation Properties
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("EntitiesModel", "FK_Accounts_Tenants", "Tenant")]
        public Tenant Tenant
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Tenant>("EntitiesModel.FK_Accounts_Tenants", "Tenant").Value;
            }
            internal set
            {
                ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Tenant>("EntitiesModel.FK_Accounts_Tenants", "Tenant").Value = value;
            }
        }
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [BrowsableAttribute(false)]
        [DataMemberAttribute()]
        public EntityReference<Tenant> TenantReference
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Tenant>("EntitiesModel.FK_Accounts_Tenants", "Tenant");
            }
            internal set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<Tenant>("EntitiesModel.FK_Accounts_Tenants", "Tenant", value);
                }
            }
        }
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("EntitiesModel", "FK_InstanceSetups_Accounts", "InstanceSetup")]
        public EntityCollection<InstanceSetup> InstanceSetups
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<InstanceSetup>("EntitiesModel.FK_InstanceSetups_Accounts", "InstanceSetup");
            }
            internal set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<InstanceSetup>("EntitiesModel.FK_InstanceSetups_Accounts", "InstanceSetup", value);
                }
            }
        }
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("EntitiesModel", "FK_UserAccounts_Accounts", "UserAccount")]
        public EntityCollection<UserAccount> UserAccounts
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<UserAccount>("EntitiesModel.FK_UserAccounts_Accounts", "UserAccount");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<UserAccount>("EntitiesModel.FK_UserAccounts_Accounts", "UserAccount", value);
                }
            }
        }

        #endregion
    }
    
    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="EntitiesModel", Name="Address")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class Address : EntityObject
    {
        #region Factory Method
    
        /// <summary>
        /// Create a new Address object.
        /// </summary>
        /// <param name="id">Initial value of the Id property.</param>
        /// <param name="line1">Initial value of the Line1 property.</param>
        /// <param name="line2">Initial value of the Line2 property.</param>
        /// <param name="line3">Initial value of the Line3 property.</param>
        /// <param name="city">Initial value of the City property.</param>
        /// <param name="state">Initial value of the State property.</param>
        /// <param name="countryCode">Initial value of the CountryCode property.</param>
        /// <param name="postalCode">Initial value of the PostalCode property.</param>
        /// <param name="type">Initial value of the Type property.</param>
        /// <param name="createdAt">Initial value of the CreatedAt property.</param>
        public static Address CreateAddress(global::System.Guid id, global::System.String line1, global::System.String line2, global::System.String line3, global::System.String city, global::System.String state, global::System.String countryCode, global::System.String postalCode, global::System.String type, global::System.DateTime createdAt)
        {
            Address address = new Address();
            address.Id = id;
            address.Line1 = line1;
            address.Line2 = line2;
            address.Line3 = line3;
            address.City = city;
            address.State = state;
            address.CountryCode = countryCode;
            address.PostalCode = postalCode;
            address.Type = type;
            address.CreatedAt = createdAt;
            return address;
        }

        #endregion
        #region Primitive Properties
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Guid Id
        {
            get
            {
                return _Id;
            }
            set
            {
                if (_Id != value)
                {
                    OnIdChanging(value);
                    ReportPropertyChanging("Id");
                    _Id = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("Id");
                    OnIdChanged();
                }
            }
        }
        private global::System.Guid _Id;
        partial void OnIdChanging(global::System.Guid value);
        partial void OnIdChanged();
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.Int64> TenantId
        {
            get
            {
                return _TenantId;
            }
            set
            {
                OnTenantIdChanging(value);
                ReportPropertyChanging("TenantId");
                _TenantId = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("TenantId");
                OnTenantIdChanged();
            }
        }
        private Nullable<global::System.Int64> _TenantId;
        partial void OnTenantIdChanging(Nullable<global::System.Int64> value);
        partial void OnTenantIdChanged();
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String Line1
        {
            get
            {
                return _Line1;
            }
            set
            {
                OnLine1Changing(value);
                ReportPropertyChanging("Line1");
                _Line1 = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("Line1");
                OnLine1Changed();
            }
        }
        private global::System.String _Line1;
        partial void OnLine1Changing(global::System.String value);
        partial void OnLine1Changed();
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String Line2
        {
            get
            {
                return _Line2;
            }
            set
            {
                OnLine2Changing(value);
                ReportPropertyChanging("Line2");
                _Line2 = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("Line2");
                OnLine2Changed();
            }
        }
        private global::System.String _Line2;
        partial void OnLine2Changing(global::System.String value);
        partial void OnLine2Changed();
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String Line3
        {
            get
            {
                return _Line3;
            }
            set
            {
                OnLine3Changing(value);
                ReportPropertyChanging("Line3");
                _Line3 = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("Line3");
                OnLine3Changed();
            }
        }
        private global::System.String _Line3;
        partial void OnLine3Changing(global::System.String value);
        partial void OnLine3Changed();
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String City
        {
            get
            {
                return _City;
            }
            set
            {
                OnCityChanging(value);
                ReportPropertyChanging("City");
                _City = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("City");
                OnCityChanged();
            }
        }
        private global::System.String _City;
        partial void OnCityChanging(global::System.String value);
        partial void OnCityChanged();
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String State
        {
            get
            {
                return _State;
            }
            set
            {
                OnStateChanging(value);
                ReportPropertyChanging("State");
                _State = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("State");
                OnStateChanged();
            }
        }
        private global::System.String _State;
        partial void OnStateChanging(global::System.String value);
        partial void OnStateChanged();
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String CountryCode
        {
            get
            {
                return _CountryCode;
            }
            set
            {
                OnCountryCodeChanging(value);
                ReportPropertyChanging("CountryCode");
                _CountryCode = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("CountryCode");
                OnCountryCodeChanged();
            }
        }
        private global::System.String _CountryCode;
        partial void OnCountryCodeChanging(global::System.String value);
        partial void OnCountryCodeChanged();
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String PostalCode
        {
            get
            {
                return _PostalCode;
            }
            set
            {
                OnPostalCodeChanging(value);
                ReportPropertyChanging("PostalCode");
                _PostalCode = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("PostalCode");
                OnPostalCodeChanged();
            }
        }
        private global::System.String _PostalCode;
        partial void OnPostalCodeChanging(global::System.String value);
        partial void OnPostalCodeChanged();
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String Type
        {
            get
            {
                return _Type;
            }
            set
            {
                OnTypeChanging(value);
                ReportPropertyChanging("Type");
                _Type = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("Type");
                OnTypeChanged();
            }
        }
        private global::System.String _Type;
        partial void OnTypeChanging(global::System.String value);
        partial void OnTypeChanged();
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.DateTime CreatedAt
        {
            get
            {
                return _CreatedAt;
            }
            set
            {
                OnCreatedAtChanging(value);
                ReportPropertyChanging("CreatedAt");
                _CreatedAt = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("CreatedAt");
                OnCreatedAtChanged();
            }
        }
        private global::System.DateTime _CreatedAt;
        partial void OnCreatedAtChanging(global::System.DateTime value);
        partial void OnCreatedAtChanged();

        #endregion
    
        #region Navigation Properties
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("EntitiesModel", "FK_Address_Tenants", "Tenant")]
        public Tenant Tenant
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Tenant>("EntitiesModel.FK_Address_Tenants", "Tenant").Value;
            }
            internal set
            {
                ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Tenant>("EntitiesModel.FK_Address_Tenants", "Tenant").Value = value;
            }
        }
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [BrowsableAttribute(false)]
        [DataMemberAttribute()]
        public EntityReference<Tenant> TenantReference
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Tenant>("EntitiesModel.FK_Address_Tenants", "Tenant");
            }
            internal set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<Tenant>("EntitiesModel.FK_Address_Tenants", "Tenant", value);
                }
            }
        }

        #endregion
    }
    
    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="EntitiesModel", Name="Blob")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class Blob : EntityObject
    {
        #region Factory Method
    
        /// <summary>
        /// Create a new Blob object.
        /// </summary>
        /// <param name="id">Initial value of the Id property.</param>
        /// <param name="originalName">Initial value of the OriginalName property.</param>
        /// <param name="contentType">Initial value of the ContentType property.</param>
        /// <param name="filePath">Initial value of the FilePath property.</param>
        /// <param name="createdAt">Initial value of the CreatedAt property.</param>
        public static Blob CreateBlob(global::System.Guid id, global::System.String originalName, global::System.String contentType, global::System.String filePath, global::System.DateTime createdAt)
        {
            Blob blob = new Blob();
            blob.Id = id;
            blob.OriginalName = originalName;
            blob.ContentType = contentType;
            blob.FilePath = filePath;
            blob.CreatedAt = createdAt;
            return blob;
        }

        #endregion
        #region Primitive Properties
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Guid Id
        {
            get
            {
                return _Id;
            }
            set
            {
                if (_Id != value)
                {
                    OnIdChanging(value);
                    ReportPropertyChanging("Id");
                    _Id = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("Id");
                    OnIdChanged();
                }
            }
        }
        private global::System.Guid _Id;
        partial void OnIdChanging(global::System.Guid value);
        partial void OnIdChanged();
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String OriginalName
        {
            get
            {
                return _OriginalName;
            }
            set
            {
                OnOriginalNameChanging(value);
                ReportPropertyChanging("OriginalName");
                _OriginalName = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("OriginalName");
                OnOriginalNameChanged();
            }
        }
        private global::System.String _OriginalName;
        partial void OnOriginalNameChanging(global::System.String value);
        partial void OnOriginalNameChanged();
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String ContentType
        {
            get
            {
                return _ContentType;
            }
            set
            {
                OnContentTypeChanging(value);
                ReportPropertyChanging("ContentType");
                _ContentType = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("ContentType");
                OnContentTypeChanged();
            }
        }
        private global::System.String _ContentType;
        partial void OnContentTypeChanging(global::System.String value);
        partial void OnContentTypeChanged();
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String FilePath
        {
            get
            {
                return _FilePath;
            }
            set
            {
                OnFilePathChanging(value);
                ReportPropertyChanging("FilePath");
                _FilePath = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("FilePath");
                OnFilePathChanged();
            }
        }
        private global::System.String _FilePath;
        partial void OnFilePathChanging(global::System.String value);
        partial void OnFilePathChanged();
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.DateTime CreatedAt
        {
            get
            {
                return _CreatedAt;
            }
            set
            {
                OnCreatedAtChanging(value);
                ReportPropertyChanging("CreatedAt");
                _CreatedAt = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("CreatedAt");
                OnCreatedAtChanged();
            }
        }
        private global::System.DateTime _CreatedAt;
        partial void OnCreatedAtChanging(global::System.DateTime value);
        partial void OnCreatedAtChanged();

        #endregion
    
        #region Navigation Properties
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("EntitiesModel", "FK_InstanceSetups_Blobs", "InstanceSetup")]
        public EntityCollection<InstanceSetup> InstanceSetups
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<InstanceSetup>("EntitiesModel.FK_InstanceSetups_Blobs", "InstanceSetup");
            }
            internal set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<InstanceSetup>("EntitiesModel.FK_InstanceSetups_Blobs", "InstanceSetup", value);
                }
            }
        }

        #endregion
    }
    
    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="EntitiesModel", Name="Credential")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class Credential : EntityObject
    {
        #region Factory Method
    
        /// <summary>
        /// Create a new Credential object.
        /// </summary>
        /// <param name="id">Initial value of the Id property.</param>
        /// <param name="login">Initial value of the Login property.</param>
        /// <param name="password">Initial value of the Password property.</param>
        /// <param name="createdAt">Initial value of the CreatedAt property.</param>
        public static Credential CreateCredential(global::System.Guid id, global::System.String login, global::System.Byte[] password, global::System.DateTime createdAt)
        {
            Credential credential = new Credential();
            credential.Id = id;
            credential.Login = login;
            credential.Password = password;
            credential.CreatedAt = createdAt;
            return credential;
        }

        #endregion
        #region Primitive Properties
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Guid Id
        {
            get
            {
                return _Id;
            }
            set
            {
                if (_Id != value)
                {
                    OnIdChanging(value);
                    ReportPropertyChanging("Id");
                    _Id = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("Id");
                    OnIdChanged();
                }
            }
        }
        private global::System.Guid _Id;
        partial void OnIdChanging(global::System.Guid value);
        partial void OnIdChanged();
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.Int64> UserId
        {
            get
            {
                return _UserId;
            }
            set
            {
                OnUserIdChanging(value);
                ReportPropertyChanging("UserId");
                _UserId = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("UserId");
                OnUserIdChanged();
            }
        }
        private Nullable<global::System.Int64> _UserId;
        partial void OnUserIdChanging(Nullable<global::System.Int64> value);
        partial void OnUserIdChanged();
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String Login
        {
            get
            {
                return _Login;
            }
            set
            {
                OnLoginChanging(value);
                ReportPropertyChanging("Login");
                _Login = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("Login");
                OnLoginChanged();
            }
        }
        private global::System.String _Login;
        partial void OnLoginChanging(global::System.String value);
        partial void OnLoginChanged();
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Byte[] Password
        {
            get
            {
                return StructuralObject.GetValidValue(_Password);
            }
            set
            {
                OnPasswordChanging(value);
                ReportPropertyChanging("Password");
                _Password = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("Password");
                OnPasswordChanged();
            }
        }
        private global::System.Byte[] _Password;
        partial void OnPasswordChanging(global::System.Byte[] value);
        partial void OnPasswordChanged();
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.DateTime CreatedAt
        {
            get
            {
                return _CreatedAt;
            }
            set
            {
                OnCreatedAtChanging(value);
                ReportPropertyChanging("CreatedAt");
                _CreatedAt = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("CreatedAt");
                OnCreatedAtChanged();
            }
        }
        private global::System.DateTime _CreatedAt;
        partial void OnCreatedAtChanging(global::System.DateTime value);
        partial void OnCreatedAtChanged();
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.DateTime> RevokedAt
        {
            get
            {
                return _RevokedAt;
            }
            set
            {
                OnRevokedAtChanging(value);
                ReportPropertyChanging("RevokedAt");
                _RevokedAt = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("RevokedAt");
                OnRevokedAtChanged();
            }
        }
        private Nullable<global::System.DateTime> _RevokedAt;
        partial void OnRevokedAtChanging(Nullable<global::System.DateTime> value);
        partial void OnRevokedAtChanged();

        #endregion
    
        #region Navigation Properties
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("EntitiesModel", "FK_Credentials_Users", "User")]
        public User User
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<User>("EntitiesModel.FK_Credentials_Users", "User").Value;
            }
            internal set
            {
                ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<User>("EntitiesModel.FK_Credentials_Users", "User").Value = value;
            }
        }
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [BrowsableAttribute(false)]
        [DataMemberAttribute()]
        public EntityReference<User> UserReference
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<User>("EntitiesModel.FK_Credentials_Users", "User");
            }
            internal set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<User>("EntitiesModel.FK_Credentials_Users", "User", value);
                }
            }
        }

        #endregion
    }
    
    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="EntitiesModel", Name="InstanceSetup")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class InstanceSetup : EntityObject
    {
        #region Factory Method
    
        /// <summary>
        /// Create a new InstanceSetup object.
        /// </summary>
        /// <param name="id">Initial value of the Id property.</param>
        /// <param name="createdAt">Initial value of the CreatedAt property.</param>
        public static InstanceSetup CreateInstanceSetup(global::System.Guid id, global::System.DateTime createdAt)
        {
            InstanceSetup instanceSetup = new InstanceSetup();
            instanceSetup.Id = id;
            instanceSetup.CreatedAt = createdAt;
            return instanceSetup;
        }

        #endregion
        #region Primitive Properties
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Guid Id
        {
            get
            {
                return _Id;
            }
            set
            {
                if (_Id != value)
                {
                    OnIdChanging(value);
                    ReportPropertyChanging("Id");
                    _Id = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("Id");
                    OnIdChanged();
                }
            }
        }
        private global::System.Guid _Id;
        partial void OnIdChanging(global::System.Guid value);
        partial void OnIdChanged();
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.Int64> TenantId
        {
            get
            {
                return _TenantId;
            }
            set
            {
                OnTenantIdChanging(value);
                ReportPropertyChanging("TenantId");
                _TenantId = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("TenantId");
                OnTenantIdChanged();
            }
        }
        private Nullable<global::System.Int64> _TenantId;
        partial void OnTenantIdChanging(Nullable<global::System.Int64> value);
        partial void OnTenantIdChanged();
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.Int64> AccountId
        {
            get
            {
                return _AccountId;
            }
            set
            {
                OnAccountIdChanging(value);
                ReportPropertyChanging("AccountId");
                _AccountId = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("AccountId");
                OnAccountIdChanged();
            }
        }
        private Nullable<global::System.Int64> _AccountId;
        partial void OnAccountIdChanging(Nullable<global::System.Int64> value);
        partial void OnAccountIdChanged();
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.DateTime CreatedAt
        {
            get
            {
                return _CreatedAt;
            }
            set
            {
                OnCreatedAtChanging(value);
                ReportPropertyChanging("CreatedAt");
                _CreatedAt = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("CreatedAt");
                OnCreatedAtChanged();
            }
        }
        private global::System.DateTime _CreatedAt;
        partial void OnCreatedAtChanging(global::System.DateTime value);
        partial void OnCreatedAtChanged();
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String LayoutName
        {
            get
            {
                return _LayoutName;
            }
            set
            {
                OnLayoutNameChanging(value);
                ReportPropertyChanging("LayoutName");
                _LayoutName = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("LayoutName");
                OnLayoutNameChanged();
            }
        }
        private global::System.String _LayoutName;
        partial void OnLayoutNameChanging(global::System.String value);
        partial void OnLayoutNameChanged();
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String ThemeName
        {
            get
            {
                return _ThemeName;
            }
            set
            {
                OnThemeNameChanging(value);
                ReportPropertyChanging("ThemeName");
                _ThemeName = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("ThemeName");
                OnThemeNameChanged();
            }
        }
        private global::System.String _ThemeName;
        partial void OnThemeNameChanging(global::System.String value);
        partial void OnThemeNameChanged();
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.Guid> LogoImageBlobId
        {
            get
            {
                return _LogoImageBlobId;
            }
            set
            {
                OnLogoImageBlobIdChanging(value);
                ReportPropertyChanging("LogoImageBlobId");
                _LogoImageBlobId = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("LogoImageBlobId");
                OnLogoImageBlobIdChanged();
            }
        }
        private Nullable<global::System.Guid> _LogoImageBlobId;
        partial void OnLogoImageBlobIdChanging(Nullable<global::System.Guid> value);
        partial void OnLogoImageBlobIdChanged();
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String ColorForHeader
        {
            get
            {
                return _ColorForHeader;
            }
            set
            {
                OnColorForHeaderChanging(value);
                ReportPropertyChanging("ColorForHeader");
                _ColorForHeader = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("ColorForHeader");
                OnColorForHeaderChanged();
            }
        }
        private global::System.String _ColorForHeader;
        partial void OnColorForHeaderChanging(global::System.String value);
        partial void OnColorForHeaderChanged();
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String ColorForHighlightedArea
        {
            get
            {
                return _ColorForHighlightedArea;
            }
            set
            {
                OnColorForHighlightedAreaChanging(value);
                ReportPropertyChanging("ColorForHighlightedArea");
                _ColorForHighlightedArea = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("ColorForHighlightedArea");
                OnColorForHighlightedAreaChanged();
            }
        }
        private global::System.String _ColorForHighlightedArea;
        partial void OnColorForHighlightedAreaChanging(global::System.String value);
        partial void OnColorForHighlightedAreaChanged();
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String ColorForH1
        {
            get
            {
                return _ColorForH1;
            }
            set
            {
                OnColorForH1Changing(value);
                ReportPropertyChanging("ColorForH1");
                _ColorForH1 = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("ColorForH1");
                OnColorForH1Changed();
            }
        }
        private global::System.String _ColorForH1;
        partial void OnColorForH1Changing(global::System.String value);
        partial void OnColorForH1Changed();
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String ColorForText
        {
            get
            {
                return _ColorForText;
            }
            set
            {
                OnColorForTextChanging(value);
                ReportPropertyChanging("ColorForText");
                _ColorForText = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("ColorForText");
                OnColorForTextChanged();
            }
        }
        private global::System.String _ColorForText;
        partial void OnColorForTextChanging(global::System.String value);
        partial void OnColorForTextChanged();

        #endregion
    
        #region Navigation Properties
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("EntitiesModel", "FK_InstanceSetups_Accounts", "Account")]
        public Account Account
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Account>("EntitiesModel.FK_InstanceSetups_Accounts", "Account").Value;
            }
            internal set
            {
                ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Account>("EntitiesModel.FK_InstanceSetups_Accounts", "Account").Value = value;
            }
        }
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [BrowsableAttribute(false)]
        [DataMemberAttribute()]
        public EntityReference<Account> AccountReference
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Account>("EntitiesModel.FK_InstanceSetups_Accounts", "Account");
            }
            internal set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<Account>("EntitiesModel.FK_InstanceSetups_Accounts", "Account", value);
                }
            }
        }
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("EntitiesModel", "FK_InstanceSetups_Tenants", "Tenant")]
        public Tenant Tenant
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Tenant>("EntitiesModel.FK_InstanceSetups_Tenants", "Tenant").Value;
            }
            internal set
            {
                ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Tenant>("EntitiesModel.FK_InstanceSetups_Tenants", "Tenant").Value = value;
            }
        }
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [BrowsableAttribute(false)]
        [DataMemberAttribute()]
        public EntityReference<Tenant> TenantReference
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Tenant>("EntitiesModel.FK_InstanceSetups_Tenants", "Tenant");
            }
            internal set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<Tenant>("EntitiesModel.FK_InstanceSetups_Tenants", "Tenant", value);
                }
            }
        }
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("EntitiesModel", "FK_InstanceSetups_Blobs", "Blob")]
        public Blob Blob
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Blob>("EntitiesModel.FK_InstanceSetups_Blobs", "Blob").Value;
            }
            internal set
            {
                ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Blob>("EntitiesModel.FK_InstanceSetups_Blobs", "Blob").Value = value;
            }
        }
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [BrowsableAttribute(false)]
        [DataMemberAttribute()]
        public EntityReference<Blob> BlobReference
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Blob>("EntitiesModel.FK_InstanceSetups_Blobs", "Blob");
            }
            internal set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<Blob>("EntitiesModel.FK_InstanceSetups_Blobs", "Blob", value);
                }
            }
        }

        #endregion
    }
    
    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="EntitiesModel", Name="Message")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class Message : EntityObject
    {
        #region Factory Method
    
        /// <summary>
        /// Create a new Message object.
        /// </summary>
        /// <param name="id">Initial value of the Id property.</param>
        /// <param name="createdAt">Initial value of the CreatedAt property.</param>
        /// <param name="customData">Initial value of the CustomData property.</param>
        /// <param name="priority">Initial value of the Priority property.</param>
        /// <param name="customDataType">Initial value of the CustomDataType property.</param>
        /// <param name="fromAddress">Initial value of the FromAddress property.</param>
        /// <param name="toAddressList">Initial value of the ToAddressList property.</param>
        /// <param name="fromAddressType">Initial value of the FromAddressType property.</param>
        /// <param name="toAddressListType">Initial value of the ToAddressListType property.</param>
        public static Message CreateMessage(global::System.Guid id, global::System.DateTime createdAt, global::System.String customData, global::System.Int32 priority, global::System.String customDataType, global::System.String fromAddress, global::System.String toAddressList, global::System.String fromAddressType, global::System.String toAddressListType)
        {
            Message message = new Message();
            message.Id = id;
            message.CreatedAt = createdAt;
            message.CustomData = customData;
            message.Priority = priority;
            message.CustomDataType = customDataType;
            message.FromAddress = fromAddress;
            message.ToAddressList = toAddressList;
            message.FromAddressType = fromAddressType;
            message.ToAddressListType = toAddressListType;
            return message;
        }

        #endregion
        #region Primitive Properties
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Guid Id
        {
            get
            {
                return _Id;
            }
            set
            {
                if (_Id != value)
                {
                    OnIdChanging(value);
                    ReportPropertyChanging("Id");
                    _Id = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("Id");
                    OnIdChanged();
                }
            }
        }
        private global::System.Guid _Id;
        partial void OnIdChanging(global::System.Guid value);
        partial void OnIdChanged();
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.DateTime CreatedAt
        {
            get
            {
                return _CreatedAt;
            }
            set
            {
                OnCreatedAtChanging(value);
                ReportPropertyChanging("CreatedAt");
                _CreatedAt = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("CreatedAt");
                OnCreatedAtChanged();
            }
        }
        private global::System.DateTime _CreatedAt;
        partial void OnCreatedAtChanging(global::System.DateTime value);
        partial void OnCreatedAtChanged();
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.DateTime> DispatchedAt
        {
            get
            {
                return _DispatchedAt;
            }
            set
            {
                OnDispatchedAtChanging(value);
                ReportPropertyChanging("DispatchedAt");
                _DispatchedAt = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("DispatchedAt");
                OnDispatchedAtChanged();
            }
        }
        private Nullable<global::System.DateTime> _DispatchedAt;
        partial void OnDispatchedAtChanging(Nullable<global::System.DateTime> value);
        partial void OnDispatchedAtChanged();
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.DateTime> DoNotDispatchBefore
        {
            get
            {
                return _DoNotDispatchBefore;
            }
            set
            {
                OnDoNotDispatchBeforeChanging(value);
                ReportPropertyChanging("DoNotDispatchBefore");
                _DoNotDispatchBefore = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("DoNotDispatchBefore");
                OnDoNotDispatchBeforeChanged();
            }
        }
        private Nullable<global::System.DateTime> _DoNotDispatchBefore;
        partial void OnDoNotDispatchBeforeChanging(Nullable<global::System.DateTime> value);
        partial void OnDoNotDispatchBeforeChanged();
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.DateTime> InvisibleUntil
        {
            get
            {
                return _InvisibleUntil;
            }
            set
            {
                OnInvisibleUntilChanging(value);
                ReportPropertyChanging("InvisibleUntil");
                _InvisibleUntil = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("InvisibleUntil");
                OnInvisibleUntilChanged();
            }
        }
        private Nullable<global::System.DateTime> _InvisibleUntil;
        partial void OnInvisibleUntilChanging(Nullable<global::System.DateTime> value);
        partial void OnInvisibleUntilChanged();
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String CustomData
        {
            get
            {
                return _CustomData;
            }
            set
            {
                OnCustomDataChanging(value);
                ReportPropertyChanging("CustomData");
                _CustomData = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("CustomData");
                OnCustomDataChanged();
            }
        }
        private global::System.String _CustomData;
        partial void OnCustomDataChanging(global::System.String value);
        partial void OnCustomDataChanged();
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int32 Priority
        {
            get
            {
                return _Priority;
            }
            set
            {
                OnPriorityChanging(value);
                ReportPropertyChanging("Priority");
                _Priority = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("Priority");
                OnPriorityChanged();
            }
        }
        private global::System.Int32 _Priority;
        partial void OnPriorityChanging(global::System.Int32 value);
        partial void OnPriorityChanged();
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String CustomDataType
        {
            get
            {
                return _CustomDataType;
            }
            set
            {
                OnCustomDataTypeChanging(value);
                ReportPropertyChanging("CustomDataType");
                _CustomDataType = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("CustomDataType");
                OnCustomDataTypeChanged();
            }
        }
        private global::System.String _CustomDataType;
        partial void OnCustomDataTypeChanging(global::System.String value);
        partial void OnCustomDataTypeChanged();
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String FromAddress
        {
            get
            {
                return _FromAddress;
            }
            set
            {
                OnFromAddressChanging(value);
                ReportPropertyChanging("FromAddress");
                _FromAddress = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("FromAddress");
                OnFromAddressChanged();
            }
        }
        private global::System.String _FromAddress;
        partial void OnFromAddressChanging(global::System.String value);
        partial void OnFromAddressChanged();
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String ToAddressList
        {
            get
            {
                return _ToAddressList;
            }
            set
            {
                OnToAddressListChanging(value);
                ReportPropertyChanging("ToAddressList");
                _ToAddressList = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("ToAddressList");
                OnToAddressListChanged();
            }
        }
        private global::System.String _ToAddressList;
        partial void OnToAddressListChanging(global::System.String value);
        partial void OnToAddressListChanged();
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String FromAddressType
        {
            get
            {
                return _FromAddressType;
            }
            set
            {
                OnFromAddressTypeChanging(value);
                ReportPropertyChanging("FromAddressType");
                _FromAddressType = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("FromAddressType");
                OnFromAddressTypeChanged();
            }
        }
        private global::System.String _FromAddressType;
        partial void OnFromAddressTypeChanging(global::System.String value);
        partial void OnFromAddressTypeChanged();
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String ToAddressListType
        {
            get
            {
                return _ToAddressListType;
            }
            set
            {
                OnToAddressListTypeChanging(value);
                ReportPropertyChanging("ToAddressListType");
                _ToAddressListType = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("ToAddressListType");
                OnToAddressListTypeChanged();
            }
        }
        private global::System.String _ToAddressListType;
        partial void OnToAddressListTypeChanging(global::System.String value);
        partial void OnToAddressListTypeChanged();

        #endregion
    
    }
    
    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="EntitiesModel", Name="Phone")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class Phone : EntityObject
    {
        #region Factory Method
    
        /// <summary>
        /// Create a new Phone object.
        /// </summary>
        /// <param name="id">Initial value of the Id property.</param>
        /// <param name="areaCode">Initial value of the AreaCode property.</param>
        /// <param name="number">Initial value of the Number property.</param>
        /// <param name="createdAt">Initial value of the CreatedAt property.</param>
        public static Phone CreatePhone(global::System.Guid id, global::System.String areaCode, global::System.String number, global::System.DateTime createdAt)
        {
            Phone phone = new Phone();
            phone.Id = id;
            phone.AreaCode = areaCode;
            phone.Number = number;
            phone.CreatedAt = createdAt;
            return phone;
        }

        #endregion
        #region Primitive Properties
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Guid Id
        {
            get
            {
                return _Id;
            }
            set
            {
                if (_Id != value)
                {
                    OnIdChanging(value);
                    ReportPropertyChanging("Id");
                    _Id = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("Id");
                    OnIdChanged();
                }
            }
        }
        private global::System.Guid _Id;
        partial void OnIdChanging(global::System.Guid value);
        partial void OnIdChanged();
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.Int64> TenantId
        {
            get
            {
                return _TenantId;
            }
            set
            {
                OnTenantIdChanging(value);
                ReportPropertyChanging("TenantId");
                _TenantId = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("TenantId");
                OnTenantIdChanged();
            }
        }
        private Nullable<global::System.Int64> _TenantId;
        partial void OnTenantIdChanging(Nullable<global::System.Int64> value);
        partial void OnTenantIdChanged();
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String AreaCode
        {
            get
            {
                return _AreaCode;
            }
            set
            {
                OnAreaCodeChanging(value);
                ReportPropertyChanging("AreaCode");
                _AreaCode = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("AreaCode");
                OnAreaCodeChanged();
            }
        }
        private global::System.String _AreaCode;
        partial void OnAreaCodeChanging(global::System.String value);
        partial void OnAreaCodeChanged();
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String Number
        {
            get
            {
                return _Number;
            }
            set
            {
                OnNumberChanging(value);
                ReportPropertyChanging("Number");
                _Number = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("Number");
                OnNumberChanged();
            }
        }
        private global::System.String _Number;
        partial void OnNumberChanging(global::System.String value);
        partial void OnNumberChanged();
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Extension
        {
            get
            {
                return _Extension;
            }
            set
            {
                OnExtensionChanging(value);
                ReportPropertyChanging("Extension");
                _Extension = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Extension");
                OnExtensionChanged();
            }
        }
        private global::System.String _Extension;
        partial void OnExtensionChanging(global::System.String value);
        partial void OnExtensionChanged();
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.DateTime CreatedAt
        {
            get
            {
                return _CreatedAt;
            }
            set
            {
                OnCreatedAtChanging(value);
                ReportPropertyChanging("CreatedAt");
                _CreatedAt = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("CreatedAt");
                OnCreatedAtChanged();
            }
        }
        private global::System.DateTime _CreatedAt;
        partial void OnCreatedAtChanging(global::System.DateTime value);
        partial void OnCreatedAtChanged();

        #endregion
    
        #region Navigation Properties
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("EntitiesModel", "FK_Phones_Tenants", "Tenant")]
        public Tenant Tenant
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Tenant>("EntitiesModel.FK_Phones_Tenants", "Tenant").Value;
            }
            internal set
            {
                ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Tenant>("EntitiesModel.FK_Phones_Tenants", "Tenant").Value = value;
            }
        }
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [BrowsableAttribute(false)]
        [DataMemberAttribute()]
        public EntityReference<Tenant> TenantReference
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Tenant>("EntitiesModel.FK_Phones_Tenants", "Tenant");
            }
            internal set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<Tenant>("EntitiesModel.FK_Phones_Tenants", "Tenant", value);
                }
            }
        }

        #endregion
    }
    
    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="EntitiesModel", Name="RoleFeature")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class RoleFeature : EntityObject
    {
        #region Factory Method
    
        /// <summary>
        /// Create a new RoleFeature object.
        /// </summary>
        /// <param name="role">Initial value of the Role property.</param>
        /// <param name="feature">Initial value of the Feature property.</param>
        /// <param name="level">Initial value of the Level property.</param>
        /// <param name="createdAt">Initial value of the CreatedAt property.</param>
        public static RoleFeature CreateRoleFeature(global::System.String role, global::System.String feature, global::System.String level, global::System.DateTime createdAt)
        {
            RoleFeature roleFeature = new RoleFeature();
            roleFeature.Role = role;
            roleFeature.Feature = feature;
            roleFeature.Level = level;
            roleFeature.CreatedAt = createdAt;
            return roleFeature;
        }

        #endregion
        #region Primitive Properties
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String Role
        {
            get
            {
                return _Role;
            }
            set
            {
                if (_Role != value)
                {
                    OnRoleChanging(value);
                    ReportPropertyChanging("Role");
                    _Role = StructuralObject.SetValidValue(value, false);
                    ReportPropertyChanged("Role");
                    OnRoleChanged();
                }
            }
        }
        private global::System.String _Role;
        partial void OnRoleChanging(global::System.String value);
        partial void OnRoleChanged();
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String Feature
        {
            get
            {
                return _Feature;
            }
            set
            {
                if (_Feature != value)
                {
                    OnFeatureChanging(value);
                    ReportPropertyChanging("Feature");
                    _Feature = StructuralObject.SetValidValue(value, false);
                    ReportPropertyChanged("Feature");
                    OnFeatureChanged();
                }
            }
        }
        private global::System.String _Feature;
        partial void OnFeatureChanging(global::System.String value);
        partial void OnFeatureChanged();
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String Level
        {
            get
            {
                return _Level;
            }
            set
            {
                OnLevelChanging(value);
                ReportPropertyChanging("Level");
                _Level = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("Level");
                OnLevelChanged();
            }
        }
        private global::System.String _Level;
        partial void OnLevelChanging(global::System.String value);
        partial void OnLevelChanged();
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.DateTime CreatedAt
        {
            get
            {
                return _CreatedAt;
            }
            set
            {
                OnCreatedAtChanging(value);
                ReportPropertyChanging("CreatedAt");
                _CreatedAt = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("CreatedAt");
                OnCreatedAtChanged();
            }
        }
        private global::System.DateTime _CreatedAt;
        partial void OnCreatedAtChanging(global::System.DateTime value);
        partial void OnCreatedAtChanged();

        #endregion
    
    }
    
    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="EntitiesModel", Name="Template")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class Template : EntityObject
    {
        #region Factory Method
    
        /// <summary>
        /// Create a new Template object.
        /// </summary>
        /// <param name="key">Initial value of the Key property.</param>
        /// <param name="customData">Initial value of the CustomData property.</param>
        /// <param name="createdAt">Initial value of the CreatedAt property.</param>
        public static Template CreateTemplate(global::System.String key, global::System.String customData, global::System.DateTime createdAt)
        {
            Template template = new Template();
            template.Key = key;
            template.CustomData = customData;
            template.CreatedAt = createdAt;
            return template;
        }

        #endregion
        #region Primitive Properties
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String Key
        {
            get
            {
                return _Key;
            }
            set
            {
                if (_Key != value)
                {
                    OnKeyChanging(value);
                    ReportPropertyChanging("Key");
                    _Key = StructuralObject.SetValidValue(value, false);
                    ReportPropertyChanged("Key");
                    OnKeyChanged();
                }
            }
        }
        private global::System.String _Key;
        partial void OnKeyChanging(global::System.String value);
        partial void OnKeyChanged();
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.Int64> TenantId
        {
            get
            {
                return _TenantId;
            }
            set
            {
                OnTenantIdChanging(value);
                ReportPropertyChanging("TenantId");
                _TenantId = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("TenantId");
                OnTenantIdChanged();
            }
        }
        private Nullable<global::System.Int64> _TenantId;
        partial void OnTenantIdChanging(Nullable<global::System.Int64> value);
        partial void OnTenantIdChanged();
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String CustomData
        {
            get
            {
                return _CustomData;
            }
            set
            {
                OnCustomDataChanging(value);
                ReportPropertyChanging("CustomData");
                _CustomData = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("CustomData");
                OnCustomDataChanged();
            }
        }
        private global::System.String _CustomData;
        partial void OnCustomDataChanging(global::System.String value);
        partial void OnCustomDataChanged();
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.DateTime CreatedAt
        {
            get
            {
                return _CreatedAt;
            }
            set
            {
                OnCreatedAtChanging(value);
                ReportPropertyChanging("CreatedAt");
                _CreatedAt = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("CreatedAt");
                OnCreatedAtChanged();
            }
        }
        private global::System.DateTime _CreatedAt;
        partial void OnCreatedAtChanging(global::System.DateTime value);
        partial void OnCreatedAtChanged();

        #endregion
    
        #region Navigation Properties
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("EntitiesModel", "FK_Templates_Tenants", "Tenant")]
        public Tenant Tenant
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Tenant>("EntitiesModel.FK_Templates_Tenants", "Tenant").Value;
            }
            internal set
            {
                ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Tenant>("EntitiesModel.FK_Templates_Tenants", "Tenant").Value = value;
            }
        }
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [BrowsableAttribute(false)]
        [DataMemberAttribute()]
        public EntityReference<Tenant> TenantReference
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Tenant>("EntitiesModel.FK_Templates_Tenants", "Tenant");
            }
            internal set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<Tenant>("EntitiesModel.FK_Templates_Tenants", "Tenant", value);
                }
            }
        }

        #endregion
    }
    
    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="EntitiesModel", Name="Tenant")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class Tenant : EntityObject
    {
        #region Factory Method
    
        /// <summary>
        /// Create a new Tenant object.
        /// </summary>
        /// <param name="id">Initial value of the Id property.</param>
        /// <param name="key">Initial value of the Key property.</param>
        /// <param name="createdAt">Initial value of the CreatedAt property.</param>
        /// <param name="companyName">Initial value of the CompanyName property.</param>
        /// <param name="displayName">Initial value of the DisplayName property.</param>
        public static Tenant CreateTenant(global::System.Int64 id, global::System.String key, global::System.DateTime createdAt, global::System.String companyName, global::System.String displayName)
        {
            Tenant tenant = new Tenant();
            tenant.Id = id;
            tenant.Key = key;
            tenant.CreatedAt = createdAt;
            tenant.CompanyName = companyName;
            tenant.DisplayName = displayName;
            return tenant;
        }

        #endregion
        #region Primitive Properties
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 Id
        {
            get
            {
                return _Id;
            }
            set
            {
                if (_Id != value)
                {
                    OnIdChanging(value);
                    ReportPropertyChanging("Id");
                    _Id = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("Id");
                    OnIdChanged();
                }
            }
        }
        private global::System.Int64 _Id;
        partial void OnIdChanging(global::System.Int64 value);
        partial void OnIdChanged();
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String Key
        {
            get
            {
                return _Key;
            }
            set
            {
                OnKeyChanging(value);
                ReportPropertyChanging("Key");
                _Key = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("Key");
                OnKeyChanged();
            }
        }
        private global::System.String _Key;
        partial void OnKeyChanging(global::System.String value);
        partial void OnKeyChanged();
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Website
        {
            get
            {
                return _Website;
            }
            set
            {
                OnWebsiteChanging(value);
                ReportPropertyChanging("Website");
                _Website = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Website");
                OnWebsiteChanged();
            }
        }
        private global::System.String _Website;
        partial void OnWebsiteChanging(global::System.String value);
        partial void OnWebsiteChanged();
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.DateTime CreatedAt
        {
            get
            {
                return _CreatedAt;
            }
            set
            {
                OnCreatedAtChanging(value);
                ReportPropertyChanging("CreatedAt");
                _CreatedAt = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("CreatedAt");
                OnCreatedAtChanged();
            }
        }
        private global::System.DateTime _CreatedAt;
        partial void OnCreatedAtChanging(global::System.DateTime value);
        partial void OnCreatedAtChanged();
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String CompanyName
        {
            get
            {
                return _CompanyName;
            }
            set
            {
                OnCompanyNameChanging(value);
                ReportPropertyChanging("CompanyName");
                _CompanyName = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("CompanyName");
                OnCompanyNameChanged();
            }
        }
        private global::System.String _CompanyName;
        partial void OnCompanyNameChanging(global::System.String value);
        partial void OnCompanyNameChanged();
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String DisplayName
        {
            get
            {
                return _DisplayName;
            }
            set
            {
                OnDisplayNameChanging(value);
                ReportPropertyChanging("DisplayName");
                _DisplayName = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("DisplayName");
                OnDisplayNameChanged();
            }
        }
        private global::System.String _DisplayName;
        partial void OnDisplayNameChanging(global::System.String value);
        partial void OnDisplayNameChanged();

        #endregion
    
        #region Navigation Properties
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("EntitiesModel", "FK_Accounts_Tenants", "Account")]
        public EntityCollection<Account> Accounts
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<Account>("EntitiesModel.FK_Accounts_Tenants", "Account");
            }
            internal set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<Account>("EntitiesModel.FK_Accounts_Tenants", "Account", value);
                }
            }
        }
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("EntitiesModel", "FK_Templates_Tenants", "Template")]
        public EntityCollection<Template> Templates
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<Template>("EntitiesModel.FK_Templates_Tenants", "Template");
            }
            internal set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<Template>("EntitiesModel.FK_Templates_Tenants", "Template", value);
                }
            }
        }
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("EntitiesModel", "FK_UserTenants_Tenants", "UserTenant")]
        public EntityCollection<UserTenant> UserTenants
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<UserTenant>("EntitiesModel.FK_UserTenants_Tenants", "UserTenant");
            }
            internal set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<UserTenant>("EntitiesModel.FK_UserTenants_Tenants", "UserTenant", value);
                }
            }
        }
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("EntitiesModel", "FK_Address_Tenants", "Address")]
        public EntityCollection<Address> Addresses
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<Address>("EntitiesModel.FK_Address_Tenants", "Address");
            }
            internal set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<Address>("EntitiesModel.FK_Address_Tenants", "Address", value);
                }
            }
        }
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("EntitiesModel", "FK_Phones_Tenants", "Phone")]
        public EntityCollection<Phone> Phones
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<Phone>("EntitiesModel.FK_Phones_Tenants", "Phone");
            }
            internal set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<Phone>("EntitiesModel.FK_Phones_Tenants", "Phone", value);
                }
            }
        }
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("EntitiesModel", "FK_InstanceSetups_Tenants", "InstanceSetup")]
        public EntityCollection<InstanceSetup> InstanceSetups
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<InstanceSetup>("EntitiesModel.FK_InstanceSetups_Tenants", "InstanceSetup");
            }
            internal set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<InstanceSetup>("EntitiesModel.FK_InstanceSetups_Tenants", "InstanceSetup", value);
                }
            }
        }

        #endregion
    }
    
    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="EntitiesModel", Name="User")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class User : EntityObject
    {
        #region Factory Method
    
        /// <summary>
        /// Create a new User object.
        /// </summary>
        /// <param name="id">Initial value of the Id property.</param>
        /// <param name="firstName">Initial value of the FirstName property.</param>
        /// <param name="lastName">Initial value of the LastName property.</param>
        /// <param name="emailAddress">Initial value of the EmailAddress property.</param>
        /// <param name="accessLevel">Initial value of the AccessLevel property.</param>
        /// <param name="isDisabled">Initial value of the IsDisabled property.</param>
        /// <param name="createdAt">Initial value of the CreatedAt property.</param>
        public static User CreateUser(global::System.Int64 id, global::System.String firstName, global::System.String lastName, global::System.String emailAddress, global::System.String accessLevel, global::System.Boolean isDisabled, global::System.DateTime createdAt)
        {
            User user = new User();
            user.Id = id;
            user.FirstName = firstName;
            user.LastName = lastName;
            user.EmailAddress = emailAddress;
            user.AccessLevel = accessLevel;
            user.IsDisabled = isDisabled;
            user.CreatedAt = createdAt;
            return user;
        }

        #endregion
        #region Primitive Properties
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 Id
        {
            get
            {
                return _Id;
            }
            set
            {
                if (_Id != value)
                {
                    OnIdChanging(value);
                    ReportPropertyChanging("Id");
                    _Id = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("Id");
                    OnIdChanged();
                }
            }
        }
        private global::System.Int64 _Id;
        partial void OnIdChanging(global::System.Int64 value);
        partial void OnIdChanged();
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String FirstName
        {
            get
            {
                return _FirstName;
            }
            set
            {
                OnFirstNameChanging(value);
                ReportPropertyChanging("FirstName");
                _FirstName = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("FirstName");
                OnFirstNameChanged();
            }
        }
        private global::System.String _FirstName;
        partial void OnFirstNameChanging(global::System.String value);
        partial void OnFirstNameChanged();
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String LastName
        {
            get
            {
                return _LastName;
            }
            set
            {
                OnLastNameChanging(value);
                ReportPropertyChanging("LastName");
                _LastName = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("LastName");
                OnLastNameChanged();
            }
        }
        private global::System.String _LastName;
        partial void OnLastNameChanging(global::System.String value);
        partial void OnLastNameChanged();
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String EmailAddress
        {
            get
            {
                return _EmailAddress;
            }
            set
            {
                OnEmailAddressChanging(value);
                ReportPropertyChanging("EmailAddress");
                _EmailAddress = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("EmailAddress");
                OnEmailAddressChanged();
            }
        }
        private global::System.String _EmailAddress;
        partial void OnEmailAddressChanging(global::System.String value);
        partial void OnEmailAddressChanged();
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String AccessLevel
        {
            get
            {
                return _AccessLevel;
            }
            set
            {
                OnAccessLevelChanging(value);
                ReportPropertyChanging("AccessLevel");
                _AccessLevel = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("AccessLevel");
                OnAccessLevelChanged();
            }
        }
        private global::System.String _AccessLevel;
        partial void OnAccessLevelChanging(global::System.String value);
        partial void OnAccessLevelChanged();
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String CultureName
        {
            get
            {
                return _CultureName;
            }
            set
            {
                OnCultureNameChanging(value);
                ReportPropertyChanging("CultureName");
                _CultureName = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("CultureName");
                OnCultureNameChanged();
            }
        }
        private global::System.String _CultureName;
        partial void OnCultureNameChanging(global::System.String value);
        partial void OnCultureNameChanged();
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.DateTime> ActivatedAt
        {
            get
            {
                return _ActivatedAt;
            }
            set
            {
                OnActivatedAtChanging(value);
                ReportPropertyChanging("ActivatedAt");
                _ActivatedAt = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("ActivatedAt");
                OnActivatedAtChanged();
            }
        }
        private Nullable<global::System.DateTime> _ActivatedAt;
        partial void OnActivatedAtChanging(Nullable<global::System.DateTime> value);
        partial void OnActivatedAtChanged();
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Boolean IsDisabled
        {
            get
            {
                return _IsDisabled;
            }
            set
            {
                OnIsDisabledChanging(value);
                ReportPropertyChanging("IsDisabled");
                _IsDisabled = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("IsDisabled");
                OnIsDisabledChanged();
            }
        }
        private global::System.Boolean _IsDisabled;
        partial void OnIsDisabledChanging(global::System.Boolean value);
        partial void OnIsDisabledChanged();
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.DateTime CreatedAt
        {
            get
            {
                return _CreatedAt;
            }
            set
            {
                OnCreatedAtChanging(value);
                ReportPropertyChanging("CreatedAt");
                _CreatedAt = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("CreatedAt");
                OnCreatedAtChanged();
            }
        }
        private global::System.DateTime _CreatedAt;
        partial void OnCreatedAtChanging(global::System.DateTime value);
        partial void OnCreatedAtChanged();

        #endregion
    
        #region Navigation Properties
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("EntitiesModel", "FK_Credentials_Users", "Credential")]
        public EntityCollection<Credential> Credentials
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<Credential>("EntitiesModel.FK_Credentials_Users", "Credential");
            }
            internal set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<Credential>("EntitiesModel.FK_Credentials_Users", "Credential", value);
                }
            }
        }
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("EntitiesModel", "FK_UserRole_Users", "UserRole")]
        public EntityCollection<UserRole> UserRoles
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<UserRole>("EntitiesModel.FK_UserRole_Users", "UserRole");
            }
            internal set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<UserRole>("EntitiesModel.FK_UserRole_Users", "UserRole", value);
                }
            }
        }
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("EntitiesModel", "FK_UserTenants_Users", "UserTenant")]
        public EntityCollection<UserTenant> UserTenants
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<UserTenant>("EntitiesModel.FK_UserTenants_Users", "UserTenant");
            }
            internal set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<UserTenant>("EntitiesModel.FK_UserTenants_Users", "UserTenant", value);
                }
            }
        }
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("EntitiesModel", "FK_UserAccounts_Users", "UserAccount")]
        public EntityCollection<UserAccount> UserAccounts
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<UserAccount>("EntitiesModel.FK_UserAccounts_Users", "UserAccount");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<UserAccount>("EntitiesModel.FK_UserAccounts_Users", "UserAccount", value);
                }
            }
        }

        #endregion
    }
    
    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="EntitiesModel", Name="UserAccount")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class UserAccount : EntityObject
    {
        #region Factory Method
    
        /// <summary>
        /// Create a new UserAccount object.
        /// </summary>
        /// <param name="userId">Initial value of the UserId property.</param>
        /// <param name="accountId">Initial value of the AccountId property.</param>
        /// <param name="createdAt">Initial value of the CreatedAt property.</param>
        public static UserAccount CreateUserAccount(global::System.Int64 userId, global::System.Int64 accountId, global::System.DateTime createdAt)
        {
            UserAccount userAccount = new UserAccount();
            userAccount.UserId = userId;
            userAccount.AccountId = accountId;
            userAccount.CreatedAt = createdAt;
            return userAccount;
        }

        #endregion
        #region Primitive Properties
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 UserId
        {
            get
            {
                return _UserId;
            }
            set
            {
                if (_UserId != value)
                {
                    OnUserIdChanging(value);
                    ReportPropertyChanging("UserId");
                    _UserId = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("UserId");
                    OnUserIdChanged();
                }
            }
        }
        private global::System.Int64 _UserId;
        partial void OnUserIdChanging(global::System.Int64 value);
        partial void OnUserIdChanged();
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 AccountId
        {
            get
            {
                return _AccountId;
            }
            set
            {
                if (_AccountId != value)
                {
                    OnAccountIdChanging(value);
                    ReportPropertyChanging("AccountId");
                    _AccountId = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("AccountId");
                    OnAccountIdChanged();
                }
            }
        }
        private global::System.Int64 _AccountId;
        partial void OnAccountIdChanging(global::System.Int64 value);
        partial void OnAccountIdChanged();
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.DateTime CreatedAt
        {
            get
            {
                return _CreatedAt;
            }
            set
            {
                OnCreatedAtChanging(value);
                ReportPropertyChanging("CreatedAt");
                _CreatedAt = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("CreatedAt");
                OnCreatedAtChanged();
            }
        }
        private global::System.DateTime _CreatedAt;
        partial void OnCreatedAtChanging(global::System.DateTime value);
        partial void OnCreatedAtChanged();

        #endregion
    
        #region Navigation Properties
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("EntitiesModel", "FK_UserAccounts_Accounts", "Account")]
        public Account Account
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Account>("EntitiesModel.FK_UserAccounts_Accounts", "Account").Value;
            }
            set
            {
                ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Account>("EntitiesModel.FK_UserAccounts_Accounts", "Account").Value = value;
            }
        }
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [BrowsableAttribute(false)]
        [DataMemberAttribute()]
        public EntityReference<Account> AccountReference
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Account>("EntitiesModel.FK_UserAccounts_Accounts", "Account");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<Account>("EntitiesModel.FK_UserAccounts_Accounts", "Account", value);
                }
            }
        }
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("EntitiesModel", "FK_UserAccounts_Users", "User")]
        public User User
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<User>("EntitiesModel.FK_UserAccounts_Users", "User").Value;
            }
            set
            {
                ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<User>("EntitiesModel.FK_UserAccounts_Users", "User").Value = value;
            }
        }
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [BrowsableAttribute(false)]
        [DataMemberAttribute()]
        public EntityReference<User> UserReference
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<User>("EntitiesModel.FK_UserAccounts_Users", "User");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<User>("EntitiesModel.FK_UserAccounts_Users", "User", value);
                }
            }
        }

        #endregion
    }
    
    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="EntitiesModel", Name="UserRole")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class UserRole : EntityObject
    {
        #region Factory Method
    
        /// <summary>
        /// Create a new UserRole object.
        /// </summary>
        /// <param name="role">Initial value of the Role property.</param>
        /// <param name="userId">Initial value of the UserId property.</param>
        /// <param name="createdAt">Initial value of the CreatedAt property.</param>
        public static UserRole CreateUserRole(global::System.String role, global::System.Int64 userId, global::System.DateTime createdAt)
        {
            UserRole userRole = new UserRole();
            userRole.Role = role;
            userRole.UserId = userId;
            userRole.CreatedAt = createdAt;
            return userRole;
        }

        #endregion
        #region Primitive Properties
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String Role
        {
            get
            {
                return _Role;
            }
            set
            {
                if (_Role != value)
                {
                    OnRoleChanging(value);
                    ReportPropertyChanging("Role");
                    _Role = StructuralObject.SetValidValue(value, false);
                    ReportPropertyChanged("Role");
                    OnRoleChanged();
                }
            }
        }
        private global::System.String _Role;
        partial void OnRoleChanging(global::System.String value);
        partial void OnRoleChanged();
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 UserId
        {
            get
            {
                return _UserId;
            }
            set
            {
                if (_UserId != value)
                {
                    OnUserIdChanging(value);
                    ReportPropertyChanging("UserId");
                    _UserId = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("UserId");
                    OnUserIdChanged();
                }
            }
        }
        private global::System.Int64 _UserId;
        partial void OnUserIdChanging(global::System.Int64 value);
        partial void OnUserIdChanged();
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.DateTime CreatedAt
        {
            get
            {
                return _CreatedAt;
            }
            set
            {
                OnCreatedAtChanging(value);
                ReportPropertyChanging("CreatedAt");
                _CreatedAt = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("CreatedAt");
                OnCreatedAtChanged();
            }
        }
        private global::System.DateTime _CreatedAt;
        partial void OnCreatedAtChanging(global::System.DateTime value);
        partial void OnCreatedAtChanged();

        #endregion
    
        #region Navigation Properties
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("EntitiesModel", "FK_UserRole_Users", "User")]
        public User User
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<User>("EntitiesModel.FK_UserRole_Users", "User").Value;
            }
            internal set
            {
                ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<User>("EntitiesModel.FK_UserRole_Users", "User").Value = value;
            }
        }
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [BrowsableAttribute(false)]
        [DataMemberAttribute()]
        public EntityReference<User> UserReference
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<User>("EntitiesModel.FK_UserRole_Users", "User");
            }
            internal set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<User>("EntitiesModel.FK_UserRole_Users", "User", value);
                }
            }
        }

        #endregion
    }
    
    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="EntitiesModel", Name="UserTenant")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class UserTenant : EntityObject
    {
        #region Factory Method
    
        /// <summary>
        /// Create a new UserTenant object.
        /// </summary>
        /// <param name="userId">Initial value of the UserId property.</param>
        /// <param name="tenantId">Initial value of the TenantId property.</param>
        /// <param name="createdAt">Initial value of the CreatedAt property.</param>
        public static UserTenant CreateUserTenant(global::System.Int64 userId, global::System.Int64 tenantId, global::System.DateTime createdAt)
        {
            UserTenant userTenant = new UserTenant();
            userTenant.UserId = userId;
            userTenant.TenantId = tenantId;
            userTenant.CreatedAt = createdAt;
            return userTenant;
        }

        #endregion
        #region Primitive Properties
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 UserId
        {
            get
            {
                return _UserId;
            }
            set
            {
                if (_UserId != value)
                {
                    OnUserIdChanging(value);
                    ReportPropertyChanging("UserId");
                    _UserId = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("UserId");
                    OnUserIdChanged();
                }
            }
        }
        private global::System.Int64 _UserId;
        partial void OnUserIdChanging(global::System.Int64 value);
        partial void OnUserIdChanged();
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 TenantId
        {
            get
            {
                return _TenantId;
            }
            set
            {
                if (_TenantId != value)
                {
                    OnTenantIdChanging(value);
                    ReportPropertyChanging("TenantId");
                    _TenantId = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("TenantId");
                    OnTenantIdChanged();
                }
            }
        }
        private global::System.Int64 _TenantId;
        partial void OnTenantIdChanging(global::System.Int64 value);
        partial void OnTenantIdChanged();
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.DateTime CreatedAt
        {
            get
            {
                return _CreatedAt;
            }
            set
            {
                OnCreatedAtChanging(value);
                ReportPropertyChanging("CreatedAt");
                _CreatedAt = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("CreatedAt");
                OnCreatedAtChanged();
            }
        }
        private global::System.DateTime _CreatedAt;
        partial void OnCreatedAtChanging(global::System.DateTime value);
        partial void OnCreatedAtChanged();

        #endregion
    
        #region Navigation Properties
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("EntitiesModel", "FK_UserTenants_Tenants", "Tenant")]
        public Tenant Tenant
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Tenant>("EntitiesModel.FK_UserTenants_Tenants", "Tenant").Value;
            }
            internal set
            {
                ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Tenant>("EntitiesModel.FK_UserTenants_Tenants", "Tenant").Value = value;
            }
        }
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [BrowsableAttribute(false)]
        [DataMemberAttribute()]
        public EntityReference<Tenant> TenantReference
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Tenant>("EntitiesModel.FK_UserTenants_Tenants", "Tenant");
            }
            internal set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<Tenant>("EntitiesModel.FK_UserTenants_Tenants", "Tenant", value);
                }
            }
        }
    
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("EntitiesModel", "FK_UserTenants_Users", "User")]
        public User User
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<User>("EntitiesModel.FK_UserTenants_Users", "User").Value;
            }
            internal set
            {
                ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<User>("EntitiesModel.FK_UserTenants_Users", "User").Value = value;
            }
        }
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [BrowsableAttribute(false)]
        [DataMemberAttribute()]
        public EntityReference<User> UserReference
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<User>("EntitiesModel.FK_UserTenants_Users", "User");
            }
            internal set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<User>("EntitiesModel.FK_UserTenants_Users", "User", value);
                }
            }
        }

        #endregion
    }

    #endregion
    
}


